package com.hyz.controller;

import com.hyz.pojo.request.ApprovalResultRequest;
import com.hyz.pojo.response.AssetImportResponse;
import com.hyz.pojo.response.AssetOutboundResponse;
import com.hyz.service.RepoManagerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pojo.ResponseResult;

import java.util.List;

/**
 * @author HGD
 * @date 2022/10/8 13:22
 */
@Api("仓管")
@RequestMapping("/repoManger")
@RestController
public class RepoManagerController {
    @Autowired
    private RepoManagerService service;

    // ----------------------------------------------------------------
    // 入库申请

    @ApiOperation("仓管获取入库申请列表")
    @PostMapping("/getAssetImports")
    public ResponseResult<List<AssetImportResponse>> getAssetImports() {
        return service.getAssetImports();
    }

    @ApiOperation("仓管审批入库申请")
    @PostMapping("/updateAssetImport")
    public ResponseResult<List<AssetImportResponse>> updateAssetImport(@RequestBody ApprovalResultRequest request) {
        return service.updateAssetImport(request);
    }

    // ----------------------------------------------------------------
    // 出库申请

    @ApiOperation("仓管获取出库申请")
    @PostMapping("/rmGetAssetOutbounds")
    public ResponseResult<List<AssetOutboundResponse>> rmGetAssetOutbounds() {
        return service.rmGetAssetOutbounds();
    }

    @ApiOperation("仓管审批出库申请")
    @PostMapping("/rmUpdateAssetOutbound")
    public ResponseResult<List<AssetOutboundResponse>> rmUpdateAssetOutbound(@RequestBody ApprovalResultRequest request) {
        return service.rmUpdateAssetOutbound(request);
    }
}
